Skip to content

feat: reserve list row height with skeleton placeholders#21

Merged
rrbe merged 4 commits into
mainfrom
worktree-skeleton-reservation
May 11, 2026
Merged

feat: reserve list row height with skeleton placeholders#21
rrbe merged 4 commits into
mainfrom
worktree-skeleton-reservation

Conversation

@rrbe
Copy link
Copy Markdown
Owner

@rrbe rrbe commented May 10, 2026

Summary

  • Reserve PR list and commits list row height with shimmer pill placeholders so rows don't visibly grow when async badge data arrives ("flash" elimination).
  • reserveInfoRowSkeletons(flags) runs synchronously inside onPageReady before any feature's async fetch starts; each feature (pr-branch-names, pr-diff-stats, commit-diff-stats) sweeps its own skeleton class after data resolves.
  • Per-feature skeleton classes (bg-skeleton-pill--branch, bg-skeleton-pill--pr-diff, bg-skeleton-pill--commit-diff) are added to FEATURE_CLASSES so the existing toggle-off cleanup path catches them.
  • feature-pr-review-status stays unreserved (conditional render — only PRs with threads), but appends into the already-reserved info row, so still no shift.

Test plan

  • pnpm build succeeds; load dist/ as unpacked extension
  • Open a busy PR list (e.g. microsoft/vscode/pulls) with DevTools → Network → Slow 3G — shimmer pills appear immediately on first paint; real badges swap in with no row-height jump (verify via DevTools → Rendering → Layout Shift Regions)
  • Open a commits list (/commits/<branch>) — same expectation
  • Toggle feature-pr-branch-names, feature-pr-diff-stats, feature-commit-diff-stats off/on in popup — skeletons cleared together with real badges
  • Edge: PR list page 2 (pagination), empty PR list, rapid back/forward navigation across PR/commits/issues — no orphan skeletons

🤖 Generated with Claude Code

rrbe and others added 4 commits May 10, 2026 23:35
PR list and commits list features inject badges only after async
GraphQL fetches complete, causing a visible row-height shift after
first paint. Synchronously reserve the eventual height with shimmer
pill placeholders before fetches start; each feature sweeps its own
skeleton class once data arrives.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reserve info-row height at document_start via a stylesheet keyed on
<html data-bg-page>, set synchronously by early-sort-redirect.ts and
re-applied on every SPA nav. This makes GitHub's first paint already
include the row slot, so content.js mounting the real row at
document_idle no longer pushes everything down.

Also align the reserved height with the real badges' outer box
(line-height 18px + 1px transparent border × 2 = 20px). The skeleton
pill and ::after slot were 18px, causing a residual 2px shift when
the real badge swapped in.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Clear skeletons in a finally block so a rejected fetch can't leave the
  shimmer pulsing forever.
- Replace the per-feature SKELETON_* constants + clearSkeletonsByClass(class)
  with a single SkeletonKind registry and clearSkeletons(kind) API.
- Collapse the duplicate hasReal/hasSkeleton predicates and reduce per-row
  querySelector calls from four to one.
- Tighten detectPageMarker regex to mirror isPRListPage / isCommitsListPage.
- Group the shared skeleton background+animation and the three identical
  ::after reservation blocks in CSS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rrbe rrbe merged commit cc35710 into main May 11, 2026
@rrbe rrbe deleted the worktree-skeleton-reservation branch May 11, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant